{% extends "manage/layout.html" %}

{% set page_title = '用户管理' %}

{% block css %}
<style type="text/css">
    #createmodal .modal-body{
        margin:20px 0 10px 10%;
    }
    .classroom{
        color: red;
    }
    .system{
        color: #545454;
    }
</style>
{% endblock %}

{% block content %}
<div class="m-content">
    {% if current_user.has_permission('EDIT') -%}
    <a class="btn btn-default" href="{{ url_for('manage.create_user') }}">创建用户</a>
    {% endif %}
    <table class="table table-striped table-condensed table-bordered">
        <thead>
            <tr>
                <th>用户名</th>
                <th>角色</th>
                <th>创建时间</th>
                {% if current_user.has_permission('EDIT') -%}
                <th>管理</th>
                {% endif %}
            </tr>
        </thead>
        <tbody>
            {% for u in users %}
            <tr id="{{ u.id }}">
                <td>{{ u.name }}</td>
                <td>{{ u.user_role }}</td>
                <td>{{ u.created_at }}</td>
                {% if current_user.has_permission('EDIT') -%}
                <td>
                    <a href="{{ url_for('manage.edit_user', uid=u.id) }}"><span class="glyphicon glyphicon-edit"></span></a>
                    <a href="{{ url_for('manage.delete_user', uid=u.id) }}"><span class="glyphicon glyphicon-trash"></span></a>
                </td>
                {% endif %}
            </tr>
            {% endfor %}
        </tbody>
    </table>
</div>

{% endblock %}

{% block js%}
{% endblock %}
